<?php

/**
 * Persona filter form base class.
 *
 * @package    zing
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasePersonaFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'nombre'          => new sfWidgetFormFilterInput(),
      'apellido'        => new sfWidgetFormFilterInput(),
      'tipoDoc'         => new sfWidgetFormChoice(array('choices' => array('' => '', 'LC' => 'LC', 'CIB' => 'CIB', 'CIC' => 'CIC', 'CIU' => 'CIU', 'RN' => 'RN', 'SD' => 'SD', 'LF' => 'LF', 'LE' => 'LE', 'DNI' => 'DNI', 'CI' => 'CI', 'PAS' => 'PAS', 'CRT' => 'CRT', 'LM' => 'LM', '--' => '--'))),
      'docNumero'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fechaNacimiento' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'sexo'            => new sfWidgetFormChoice(array('choices' => array('' => '', 'F' => 'F', 'M' => 'M', 'O' => 'O'))),
      'activo'          => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'cuil'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'created_at'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'nombre'          => new sfValidatorPass(array('required' => false)),
      'apellido'        => new sfValidatorPass(array('required' => false)),
      'tipoDoc'         => new sfValidatorChoice(array('required' => false, 'choices' => array('LC' => 'LC', 'CIB' => 'CIB', 'CIC' => 'CIC', 'CIU' => 'CIU', 'RN' => 'RN', 'SD' => 'SD', 'LF' => 'LF', 'LE' => 'LE', 'DNI' => 'DNI', 'CI' => 'CI', 'PAS' => 'PAS', 'CRT' => 'CRT', 'LM' => 'LM', '--' => '--'))),
      'docNumero'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'fechaNacimiento' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'sexo'            => new sfValidatorChoice(array('required' => false, 'choices' => array('F' => 'F', 'M' => 'M', 'O' => 'O'))),
      'activo'          => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'cuil'            => new sfValidatorPass(array('required' => false)),
      'created_at'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('persona_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Persona';
  }

  public function getFields()
  {
    return array(
      'id'              => 'Number',
      'nombre'          => 'Text',
      'apellido'        => 'Text',
      'tipoDoc'         => 'Enum',
      'docNumero'       => 'Number',
      'fechaNacimiento' => 'Date',
      'sexo'            => 'Enum',
      'activo'          => 'Boolean',
      'cuil'            => 'Text',
      'created_at'      => 'Date',
      'updated_at'      => 'Date',
    );
  }
}
